using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using ZoneFiveSoftware.Common.Data;
using ZoneFiveSoftware.Common.Data.Fitness;
using ZoneFiveSoftware.Common.Visuals.Chart;

namespace FilteredStatistics.Common
{
    // This interface is used to provide new tracks to be displayed in the Filtered
    //  Statistics chart.  Even though this interface is publicly available, I do not
    //  recommend deriving from it in order to avoid static links with the Filtered
    //  Statistics DLL.  Plugins should implement all the following functions in
    //  another class that is then passed to the ActivityDataTrackController's
    //  RegisterDataTrackProvider method.  The controller will then create a proxy
    //  object using reflection to call the right functions in your class in order to
    //  get the right data
    public interface IActivityDataTrackProvider
    {
        // A unique ID to identify the data track.  This is used to save which tracks
        //  are visible and to restore on the next execution of ST
        Guid ReferenceId { get; }

        // Setter for the activity the following methods must refer to if required
        IActivity Activity { set; }

        // Bool to indicate if the track is a "primary" data track.  "Primary" data
        //  tracks appear in the main drop down menu (under ordinate) as well as in
        //  extra charts.  "Secondary" data track only appear in extra charts.
        bool IsPrimaryDataTrack { get; }

        // A short (1-2 words) label to display in the data track's axis and in the
        //  chart header
        string YAxisLabel { get; }

        // A label for the data track's unit (meters, percent, etc.).  This is appended
        //  to the YAxisLabel in the chart's axis text
        string YAxisUnitLabel { get; }

        // A color to use for the data track when it is used as an extra chart.  This
        //  color isn't used for the main chart as it has configurable colors
        Color TrackColor { get; }

        // An axis formatter to be used to setup the data track's axis
        IAxisFormatter AxisFormatter { get; }

        // The data track's smoothed data.  This INumericTimeDataSeries must include
        //  the whole activity (all pauses/stopped times included) just like what is
        //  returned by the SportTracks API
        INumericTimeDataSeries SmoothedDataTrack { get; }

        // A list of unique IDs for the different possible zones for this data track.
        //  This is used to setup axis stripes in the chart in junction with the
        //  following functions.  This can be null if there are no zones
        IList<Guid> DataTrackZoneGuids { get; }

        // The unique ID of the default zone which is set by default.  This can be
        //  activity dependent, like speed or heart rate zones.
        Guid DefaultZone { get; }

        // Getter for the name to display in the zone drop down menu, given a unique
        //  ID as returned by DataTrackZoneGuids
        string GetDataTrackZoneName(Guid zoneId);

        // A list of correctly setup AxisStripes for a given unique id as returned by
        //  DataTrackZoneGuids.  Note that some of the AxisStripe's properties will be
        //  reset to default values.  The properties that must absolutely be set are
        //  name, lower bound and upper bound.  Al the other properties will be reset.
        IList<AxisStripe> GetDataTrackZones(Guid zoneId);

        // An event that must be fired when the data track needs to be updated.  For
        //  instance, if your track is derived from cadence and the cadence track is
        //  modified, you msut fire this event so the chart is correctly updated
        event PropertyChangedEventHandler DataTrackChanged;
    }
}
